import { useLocation } from "react-router-dom";
import { routersData, type RouterKeys } from "@/config";

// 获取对应菜单key
function useShowMenu() {
	const location = useLocation();
	const key: RouterKeys = location.pathname.split("/")[1] as RouterKeys;
	if (!key) {
		return false;
	}

	if (routersData[key].hasMenu) {
		return true;
	} else {
		return false;
	}
}

export default useShowMenu;
